export default {
	data() {
		return {
			// testList:testList,//测试数据
			// testList: [],//测试数据
			pageNo: 1,
			pageSize: 10,
			total: 0,
			loadStatus: 'loading',
			loadTextObj: {
				contentdown: '上拉加载更多', // more
				contentrefresh: '加载中...', // loading
				contentnomore: '没有更多数据了' // noMore
			}
		}
	},
	computed: {
		len() {
			return this.lists.length;
		}
	},
	watch: {
		lists: {
			handler: function(val) {
				// console.log("handler",val)
				if (val.length) {
					this.$set(this.loadTextObj, 'contentnomore', '没有更多数据了');
				} else {
					this.$set(this.loadTextObj, 'contentnomore', '');
				}
			},
			immediate: true
		}
	},
	onPullDownRefresh() {
		this.init();
		this.getList();
	},
	onReachBottom() {
		if (this.len < this.total) {
			this.pageNo++;
			this.getList();
		} else {
			this.loadStatus = 'noMore';
		}
	},
	methods: {
		init() {
			this.total = 0;
			this.lists = [];
			this.pageNo = 1;
			this.pageSize = 20;
		}
	}
}
